package com.app.util;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;

import androidx.annotation.Nullable;
//操作数据库的
public class DBHelper extends SQLiteOpenHelper {
        //数据库创建的sql语句
    private static final String User = "CREATE TABLE user (\n" +
            "    id INTEGER PRIMARY KEY AUTOINCREMENT,\n" +
            "    username TEXT,\n" +
            "    user_id TEXT UNIQUE,\n" +
            "    password TEXT,\n" +
            "    phone_number TEXT,\n" +
            "    id_card TEXT,\n" +
            "    gender INTEGER\n" +
            ");";
    //指定数据库的库名是user.db
    public DBHelper(@Nullable Context context) {
        super(context, "user.db", null, 1);
    }

    @Override
    public void onCreate(SQLiteDatabase db) {
        db.execSQL(User);
    }

    @Override
    public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
    }

}
